package com.ss12.bustrack;

import java.util.Locale;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;

public class BusTrack extends Activity implements OnInitListener
{
    private TextToSpeech tts;
    private String messageBuff;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        
        messageBuff = new String();
        giveInitInstructions();
    }
    /** Give the introduction speech to the user. */
    public void giveInitInstructions()
    {
    	// Text to Speech
    	Intent text2voiceIntent = new Intent();
    	text2voiceIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
        
    	messageBuff = getResources().getString(R.string.intro_prompt);
 	
    	
    	tts = new TextToSpeech(this, this);
    	startActivity(text2voiceIntent);
    	
    	startActivity(new Intent(getApplicationContext(), GestureInput.class));
    }
    
	@Override
	/** Set up the Text-to-Speech message buffer. */
	public void onInit(int status) 
	{
		if(status == TextToSpeech.SUCCESS)
		{
			 tts.setLanguage(Locale.US);
             tts.speak(messageBuff, TextToSpeech.QUEUE_FLUSH, null);
		}
		
	}
    
}